// Copyright (c) 2024 Go-Frame-Lite
// Go-Frame-Lite is licensed under Mulan PSL v2.
// You can use this software according to the terms and conditions of the Mulan
// PSL v2.
// You may obtain a copy of Mulan PSL v2 at:
//         http://license.coscl.org.cn/MulanPSL2
// THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY
// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
// NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
// See the Mulan PSL v2 for more details.

// Package configtypes defines common data structures and configuration types used throughout the application.
package configtypes

import "time"

// ServerConfig 服务器配置
type ServerConfig struct {
	Addr         string        `yaml:"addr" json:"addr" mapstructure:"addr"`
	ReadTimeout  time.Duration `yaml:"read_timeout" json:"read_timeout" mapstructure:"read_timeout"`
	WriteTimeout time.Duration `yaml:"write_timeout" json:"write_timeout" mapstructure:"write_timeout"`
	IdleTimeout  time.Duration `yaml:"idle_timeout" json:"idle_timeout" mapstructure:"idle_timeout"`
	EnableWS     bool          `yaml:"enable_ws" json:"enable_ws" mapstructure:"enable_ws"`
}

// LogConfig 日志配置
type LogConfig struct {
	Level    string `mapstructure:"level"`
	FilePath string `mapstructure:"file_path"`
	MaxSize  int    `mapstructure:"max_size"`
	MaxAge   int    `mapstructure:"max_age"`
	Console  bool   `mapstructure:"console"`
}

// MonitorConfig 监控配置
type MonitorConfig struct {
	Enabled      bool   `yaml:"enabled" json:"enabled" mapstructure:"enabled"`
	MetricsPath  string `yaml:"metrics_path" json:"metrics_path" mapstructure:"metrics_path"`
	MetricsPort  string `yaml:"metrics_port" json:"metrics_port" mapstructure:"metrics_port"`
	CollectRoute bool   `yaml:"collect_route" json:"collect_route" mapstructure:"collect_route"`
}

// AppConfig 应用配置
type AppConfig struct {
	Server  ServerConfig  `mapstructure:"server"`
	Log     LogConfig     `mapstructure:"log"`
	Trace   TraceConfig   `mapstructure:"trace"`
	Monitor MonitorConfig `mapstructure:"monitor"`
}
